from wtforms import StringField, IntegerField
from wtforms.validators import DataRequired, Length, Email, Regexp
from app.libs.enums import ClientTypeEnum
from app.models.user import User
from wtforms import ValidationError
from app.validators.base import BaseForm as Form


class CreateCaseForm(Form):  # 不同客户端的注册信息的共有属性
    module_name = StringField(validators=[DataRequired(message='不允许为空'), Length(min=1, max=50)])  # 功能模块名称，可为空
    title = StringField(validators=[DataRequired(message='不允许为空'), Length(min=1, max=50)])  # 标题，不可为空
    priority = IntegerField(validators=[DataRequired()])  # 优先级 不可为空
    precondition = StringField(validators=[Length(min=1, max=50)])  # 前置条件，可为空
    operating_steps = StringField(validators=[DataRequired(message='不允许为空'), Length(min=1, max=1000)])  # 操作步骤，不可为空
    expected_result = StringField(validators=[DataRequired(message='不允许为空'), Length(min=1, max=50)])  # 预期结果，不可为空
    actual_result = StringField(validators=[DataRequired(message='不允许为空'), Length(min=1, max=50)])  # 实际结果，不可为空
    test_result = IntegerField(validators=[DataRequired()])  # 测试结果 0是测试失败 1是测试成功 2是未开始测试
    bug = StringField(validators=[DataRequired(message='不允许为空'), Length(min=1, max=50)])

class UpdateCaseForm(CreateCaseForm):
    id=IntegerField(validators=[DataRequired()])

class IdFrom(Form):
    id = IntegerField(validators=[DataRequired()])

class SelectFrom(Form):
    priority = IntegerField(validators=[])  # 优先级查询